<?php

namespace app\upload\controller;

use think\Controller;
use think\Request;

class Upload extends Controller
{
    /**
     * 文件上传
     * @param Request $request
     * @return \think\response\Json
     */
    public function upload(Request $request)
    {
        $info = $request->file('file')->move('./static');
        return baseResponse(0, '上传成功', [
            "title" => $info->getFilename(),
            "src" => "/static/" . $info->getSaveName(),
            "url" => "/static/" . $info->getSaveName(),
        ]);
    }
}
